package com.itheima.practice.demo05;

public class demo01 {

    public static void main(String[] args) {
        Human human = new Human();
        human.fight();
        Robot robot = new Robot();
        robot.fight();
        Dog dog = new Dog();
        dog.fight();

        //用父类对象接收第三方方法返回的子类对象
        Fight fight1 = FightFactory.getFight();
        //用父类对象调用子类重写的方法
        fight1.fight();

        //用接口对象接收第三方方法返回的子类对象
        InterFight interFight = FightFactory.getInterFight();
        //用接口对象调用子类重写的方法
        interFight.fight();
    }
}
